
public class Rayon {
	
	private Pullover [] t;
	private final int tailleMax = 30;
	
	public Rayon(Pullover pull) {
		t = new Pullover[1];
		t[0] = pull;
	}

	public boolean ajoutPull(Pullover p){
		
		if(this.t.length < tailleMax){
			Pullover [] tp = new Pullover [this.t.length+1] ;
			System.arraycopy(this.t,0,tp,0,this.t.length);
			tp[t.length] = p;
			this.t = tp;
			return true;
		}
		else 
			return false;
	}

	public void afficheRayon(){
		System.out.println("Le rayon a les articles suivants:");
		for(int i = 0 ; i < t.length ; i++ )
			System.out.println(t[i]);
	}
	
	public int enleverPull(){
		int perte = 0;
		for(int i = 0 ; i < t.length ; i++)
			if(t[i].isAbime() == true){
				t[i] = null;
				perte += t[i].getPrix();
			}
		return perte;
	}
	
	public int enleverPull(String couleur){
		int perte = 0;
		for(int i = 0 ; i < t.length ; i++)
			if((t[i].getCouleur()).equals(couleur) && t[i].isAbime() == true){
					t[i] = null;
					perte += t[i].getPrix();
			}
		return perte;
	}	
	
	public void triBulle(){
		Pullover temp;
		for (int j = 0; j < t.length; j++)
			for (int i = 0; i < t.length-j-1; i++)
				if(t[i].compareTo(t[i+1]) >= 1){
					temp = t[i];
					t[i] = t[i+1];
					t[i+1] = temp;
				}
	}
	
	public void associer(){
		for (int i = 0; i < t.length; i++) 
			for (int j = i ; j < t.length-i; j++) {
				
			}
	}
}
